﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Intel_Client_GUI
{
	/// <summary>
	/// DateSelectControl.xaml 的交互逻辑
	/// </summary>
	public partial class DateSelectControl : UserControl
	{
		public DateSelectControl()
		{
			this.InitializeComponent();
		}
		
		public static DependencyProperty TimeInfoTextProperty = DependencyProperty.Register(
			"TimeInfoText",typeof(string),typeof(DateSelectControl));
		
		public string TimeInfoText
		{
			set{this.SetValue(DateSelectControl.TimeInfoTextProperty,(string)value);}
			get{return (string)this.GetValue(DateSelectControl.TimeInfoTextProperty);}
		}
		
		public DateTimeModel.TimeInfo TimeDate
		{
			get{return dtm.TimeAndDuration;}
			set{dtm.TimeAndDuration = value;}
		}
		
		private DateTimeModel dtm  = Globle.DateTimeData;

		private void Last24HourChecked(object sender, System.Windows.RoutedEventArgs e)
		{
			// 在此处添加事件处理程序实现。
			this.TimeDate = new DateTimeModel.TimeInfo(DateTime.Now-TimeSpan.FromDays(1),TimeSpan.FromDays(1));
			this.TimeInfoText="Last 24 Hours";
		}

		private void Last3Days(object sender, System.Windows.RoutedEventArgs e)
		{
			// 在此处添加事件处理程序实现。
			this.TimeDate = new DateTimeModel.TimeInfo(DateTime.Now-TimeSpan.FromDays(3),TimeSpan.FromDays(3));
			this.TimeInfoText="Last three days";
		}

        private void LastWeek(object sender, RoutedEventArgs e)
        {
            this.TimeDate = new DateTimeModel.TimeInfo(DateTime.Now-TimeSpan.FromDays(7),TimeSpan.FromDays(7));
            this.TimeInfoText = "Last week";
        }

        private void LastThreeMonth(object sender, System.Windows.RoutedEventArgs e)
        {
        	// 在此处添加事件处理程序实现。
			this.TimeDate = new DateTimeModel.TimeInfo(DateTime.Now-TimeSpan.FromDays(90) ,TimeSpan.FromDays(90));
            this.TimeInfoText = "Last 3 Months";
        }

        private void LastMonth(object sender, System.Windows.RoutedEventArgs e)
        {
        	// 在此处添加事件处理程序实现。
			 this.TimeDate = new DateTimeModel.TimeInfo(DateTime.Now-TimeSpan.FromDays(30),TimeSpan.FromDays(30));
            this.TimeInfoText = "Last Month";
        }
	}
}